package com.surekam.dma.entity.dma.dms;
import java.sql.Blob;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import com.surekam.dma.entity.IdEntity;
import com.surekam.dma.entity.account.User;
import com.surekam.dma.entity.content.Directory;
@Entity
//表名与类名不相同时重新定义表名.
@Table(name = "acct_document")
//默认的缓存策略.
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Document extends IdEntity{
	private String name;
	private float filesize;
	private Date createTime;
	private Blob content;
	private User user;//创建者
	private DocuType docuType;//文档类型
	private Directory directory;
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}

	public float getFilesize() {
		return filesize;
	}
	public void setFilesize(float filesize) {
		this.filesize = filesize;
	}
	public Date getCreateTime() {
		return createTime;
	}
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	public Blob getContent() {
		return content;
	}
	public void setContent(Blob content) {
		this.content = content;
	}
	@ManyToOne
	@JoinColumn(name="t_user_id")
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}
	@ManyToOne
	@JoinColumn(name="docuType_id")
	public DocuType getDocuType() {
		return docuType;
	}
	public void setDocuType(DocuType docuType) {
		this.docuType = docuType;
	}
	@ManyToOne
	@JoinColumn(name="contentInfo_id")
	public Directory getDirectory() {
		return directory;
	}
	public void setDirectory(Directory directory) {
		this.directory = directory;
	}
	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this);
	}
	
}
